//
//  CheckInfoViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/27.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "CheckInfoViewModel.h"
#import "CheckInfoFrame.h"
#import "CheckInfoModel.h"


static NSString *const checkInfo_url = @"api/Account/GetOuptExam";

@implementation CheckInfoViewModel

-(void)getCheckInfoSuccess:(void (^)())completion{
    NSDictionary *dic = @{@"patient_id":[User currentUser].patientId,@"patient_source":_patientSource};
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,checkInfo_url];
    [NetWorker getCommonDatasWithURLStr:url body:dic success:^(id result) {
        NSArray *resultArr = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *checkInfoArr = [NSMutableArray array];
        for (NSDictionary *dic in resultArr) {
            CheckInfoModel *model = [CheckInfoModel checkInfoWithDic:dic];
            CheckInfoFrame *checkInfoFrame = [[CheckInfoFrame alloc] init];
            checkInfoFrame.checkInfo = model;
            [checkInfoArr addObject:checkInfoFrame];
        }
        _datasArray = [NSArray arrayWithArray:checkInfoArr];
        completion(_datasArray);
    } failure:^(id result) {
        _datasArray = [NSArray array];
        completion();
    }];

}

@end
